package com.it.service.impl;

import com.it.dao.AccountDao;
import com.it.pojo.Account;
import com.it.service.AccountService;

public class AccountServiceImpl implements AccountService {

    private AccountDao accountDao;

    public void setAccountDao(AccountDao accountDao) {
        this.accountDao = accountDao;
    }

    public void transferMoney(Integer inId, Integer outId, Float money) {
        /*
        根据id查用户
         */
        Account byInAccount = accountDao.findById(inId);
        System.out.println("byInAccount = " + byInAccount);
        Account byOutAccount = accountDao.findById(outId);
        System.out.println("byOutAccount = " + byOutAccount);

        /*
        根据id转进转出
         */
        accountDao.transferIn(inId,money);
        accountDao.transferOut(outId,money);
    }
}
